package com.javasm.entity;

import org.springframework.beans.factory.InitializingBean;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.stereotype.Component;

@Component
public class PermissionAuth {
    public boolean check(String functionCode){
        Authentication authentication= SecurityContextHolder.getContext().getAuthentication();;
        LoginUser loginUser = (LoginUser) authentication.getPrincipal();
        return loginUser.getPermissions().contains(functionCode);
    }


}
